package com.randi.system.domain.vo;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.randi.common.core.domain.dto.TreeNode;
import com.randi.common.core.domain.entity.SysMenu;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * @author ziye
 */
@EqualsAndHashCode(callSuper = true)
@Data
@ApiModel(value = "AuthMenu", description = "授权菜单树")
public class AuthMenu extends TreeNode {

    @ApiModelProperty(value = "key")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long value;

    @ApiModelProperty(value = "菜单项标题")
    private String label;

    public AuthMenu(SysMenu sysMenu) {
        this.id = sysMenu.getMenuId();
        this.parentId = sysMenu.getParentId();
        this.value = sysMenu.getMenuId();
        this.label = sysMenu.getMenuName();
    }

}
